import { AxiosResponse } from 'axios'
import $axios, { Result } from '@/plugins/axios'

/**
 * 查询所有菜单信息
 * @param data
 */
export async function getMenuList(data: {
  type: string
}): Promise<AxiosResponse<Result>> {
  return await $axios.post(`/supervision-api/sys/menu/list`, data)
}

/**
 * 添加或者修改菜单
 * @param data 菜单信息
 */
export async function saveMenu(data: any): Promise<AxiosResponse<Result>> {
  return await $axios.post(`/supervision-api/sys/menu/save`, data)
}

/**
 * 删除
 * @param id id
 */
export async function deleteMenuById(
  id: number,
): Promise<AxiosResponse<Result>> {
  return await $axios.get(`/supervision-api/sys/menu/delete/${id}`)
}
